package com.example.demo.controller;

import com.example.demo.controller.response.UnifiedResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import com.example.demo.domain.UserEntity;
import com.example.demo.service.UserService;

import io.swagger.annotations.ApiOperation;

/**
 * @Description
 * @ClassName UserController
 * @Author: jinqi.zhu
 * @Create: 2021/8/16 10:38
 */
@RestController
@UnifiedResponse
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping(value = "/user", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "添加用户")
    public UserEntity sava(@RequestBody UserEntity user) {
        return userService.save(user);
    }
}
